using FreeSql.DataAnnotations;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;

namespace ProjectManageSystemApi.DbEntity
{

	/// <summary>
	/// 费用表
	/// </summary>
	[JsonObject(MemberSerialization.OptIn), Table(Name = "cost_info", DisableSyncStructure = true)]
	public partial class CostInfo {

		[JsonProperty, Column(Name = "id", IsPrimary = true, IsIdentity = true)]
		public int Id { get; set; }

		/// <summary>
		/// 所属工程 id
		/// </summary>
		[JsonProperty, Column(Name = "project_id")]
		public int ProjectId { get; set; }

		/// <summary>
		/// 所属项目 id
		/// </summary>
		[JsonProperty, Column(Name = "item_id")]
		public int ItemId { get; set; }

		/// <summary>
		/// 申请人id
		/// </summary>
		[JsonProperty, Column(Name = "user_id")]
		public long UserId { get; set; }

		/// <summary>
		/// 费用名称
		/// </summary>
		[JsonProperty, Column(Name = "cost_name", StringLength = 50)]
		public string CostName { get; set; }

		/// <summary>
		/// 报销金额
		/// </summary>
		[JsonProperty, Column(Name = "cost_amount", DbType = "decimal(8,2)")]
		public decimal CostAmount { get; set; }

		/// <summary>
		/// 费用描述
		/// </summary>
		[JsonProperty, Column(Name = "cost_desc", StringLength = 200)]
		public string CostDesc { get; set; }

		/// <summary>
		/// 项目数量
		/// </summary>
		[JsonProperty, Column(Name = "cost_count")]
		public int? CostCount { get; set; }

		/// <summary>
		/// 费用类型
		/// </summary>
		[JsonProperty, Column(Name = "cost_type_id")]
		public int CostTypeId { get; set; }

		/// <summary>
		/// 0:未支付，1:已支付
		/// </summary>
		[JsonProperty, Column(Name = "pay_state")]
		public int PayState { get; set; }

		/// <summary>
		/// 经理 审核时间
		/// </summary>
		[JsonProperty, Column(Name = "manager_approve_time")]
        public DateTime? ManagerApproveTime { get; set; }

		/// <summary>
		/// 经理 审核人
		/// </summary>
		[JsonProperty, Column(Name = "manager_approve_user")]
		public long? ManagerApproveUser { get; set; }

		/// <summary>
		/// 经理 审核理由
		/// </summary>
		[JsonProperty, Column(Name = "manager_approve_reason", StringLength = 200)]
		public string ManagerApproveReason { get; set; }

		/// <summary>
		/// 财务 审核时间
		/// </summary>
		[JsonProperty, Column(Name = "financer_approve_time")]
		public DateTime? FinancerApproveTime { get; set; }

		/// <summary>
		/// 财务 审核人
		/// </summary>
		[JsonProperty, Column(Name = "financer_approve_user")]
		public long? FinancerApproveUser { get; set; }

		/// <summary>
		/// 财务 审核理由
		/// </summary>
		[JsonProperty, Column(Name = "financer_approve_reason", StringLength = 200)]
		public string FinancerApproveReason { get; set; }

		/// <summary>
		/// 创建时间
		/// </summary>
		[JsonProperty, Column(Name = "create_time")]
		public DateTime CreateTime { get; set; }

		/// <summary>
		/// 创建人
		/// </summary>
		[JsonProperty, Column(Name = "create_user", StringLength = 20)]
		public long CreateUser { get; set; }

		/// <summary>
		/// 状态(0: 未审核; 1: 经理审核通过; 2: 财务审批通过; 100: 经理审批拒绝; 101: 财务审批拒绝; 120: 删除[未审核的申请可以由发起人删除])
		/// </summary>
		[JsonProperty, Column(Name = "state", DbType = "tinyint(4)")]
		public sbyte State { get; set; }

		/// <summary>
		/// 申请人信息
		/// </summary>
		[Navigate(nameof(UserId))]
		public UserInfo UserInfo { get; set; }

		/// <summary>
		/// 财务审核人信息
		/// </summary>
		[Navigate(nameof(FinancerApproveUser))]
		public UserInfo FinancerApproveUserInfo { get; set; }

		/// <summary>
		/// 经理审核人信息
		/// </summary>
		[Navigate(nameof(ManagerApproveUser))]
		public UserInfo ManagerApproveUserInfo { get; set; }

		[Navigate(nameof(CostImageInfo.CostId))]
		public List<CostImageInfo> Images { get; set; } = new List<CostImageInfo>();

		/// <summary>
		/// 报销类型表
		/// </summary>
		[Navigate(nameof(CostTypeId))]
		public CostType CostType { get; set; }

		/// <summary>
		/// 工程信息
		/// </summary>
		[Navigate(nameof(ProjectId))]
		public ProjectInfo ProjectInfo { get; set; }

		/// <summary>
		/// 项目信息
		/// </summary>
		[Navigate(nameof(ItemId))]
		public ItemInfo ProjectItemInfo { get; set; }
	}

}
